package com.dragon.wangyiwork.controller;


import com.dragon.wangyiwork.beans.AjaxResult;
import com.dragon.wangyiwork.entity.Commodity;
import com.dragon.wangyiwork.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class OrderController {

    @Autowired
    private CommodityService commodityService;

    @PostMapping("/buy")
    @ResponseBody
    public AjaxResult buyCommodity(@RequestBody Commodity[] commodityList){
        commodityService.buyCommodity(commodityList);
        return AjaxResult.success();
    }
}
